var app = getApp();
Page({
  data: {
    value: '',
    showVoice: false,
    banner: [], //banner图
    classList: [], //分类列表
    shopList : [],
    indicatorDots: true,
    autoplay: true,  //是否自动切换
    vertical: false,  //
    interval: 3000, //自动切换时间间隔。
    circular: false,  //是否启用无限滑动
    marqueeProps: {
      loop: true,
      leading: 1000,
      trailing: 800,
      fps: 40,
    },
  },
  onLoad() {
    my.getAuthCode({
       scopes: 'auth_base',
       success: (res) => {
         console.log(res)
       }
    });
    app.editTabBar();
    let that = this;
    //banner
    my.request({
      url: 'https://openpay.duolaibei.com/mobile/index/banner',
      method: 'POST',
      success(res) {
        that.setData({
          banner: res.data.content
        });
      }
    });
    //class
    my.request({
      url: 'https://openpay.duolaibei.com/mobile/index/getClass',
      method: 'POST',
      success(res) {
        that.setData({
          classList: res.data.content
        });
      }
    });
    //shop
    my.request({
      url: 'https://openpay.duolaibei.com/mobile/index/getShop',
      method: 'POST',
      success(res) {
        that.setData({
          shopList: res.data.content
        });
        console.log(that.data.shopList);
        
      }
    });



  },
  handleInput(value) {
    this.setData({
      value,
    });
  },
  handleClear() {
    this.setData({
      value: '',
    });
  },
  handleCancel() {
    this.setData({
      value: '',
    });
  },
  onChange(e) {
    this.setData({
      showVoice: e.detail.value,
    });
  },
  changeIndicatorDots(e) {
    this.setData({
      indicatorDots: !this.data.indicatorDots,
    });
  },
  changeVertical() {
    this.setData({
      vertical: !this.data.vertical,
    });
  },
  changeCircular(e) {
    this.setData({
      circular: !this.data.circular,
    });
  },
  changeAutoplay(e) {
    this.setData({
      autoplay: !this.data.autoplay,
    });
  },
  intervalChange(e) {
    this.setData({
      interval: e.detail.value,
    });
  },
  details(value) {
    my.navigateTo({
      url: '/pages/details/details'
    });
  },
  cat(event) {
    //  my.navigateTo({
    //   url:'/pages/min/min?merchantID=220676163440446776&order_no=DLB1647568917713715045658565OP&external_order_no=CAIPAY1646838408992039019&money=0.01&body=测试'
    // });
    //  my.navigateTo({
    //   url:'/pages/h5/h5?merchantID=220521673164343541&money=1&body=cs'
    // });
    my.showToast({
      content: '暂时没有数据',
      duration:1000
    });
    //console.log(event.target.dataset.id)
  }
});
